#ifndef _PRIVILEGE_H_
#define _PRIVILEGE_H_

/* 
 * Defines whether a user has enough privileges
 * to view the file or not.
 * Receives the username and title.
 * Assumes the user is a valid user that has been 
 * authenticated correctly.
 * Returns 1 for true, 0 for false.
 */
int hasAnyPrivilege(char * user, char * title);

int hasPrivilege(char * user, char * title, char * sectorname);

/*
 * Retrieves a list of users that have the same privilege than
 * the one passed as parameter. This includes the one with lower
 * privileges in the same sector as well.
 */
t_users * getSamePrivilegeUsers(char * user);

/*
 * Retrieves the level for a given document and sector.
 * Returns "" if an error occurred or no document exists.
 */
char * getPrivilege(char * title, char * sector);

/*
 * Retrieves the public key for a user, or "" if the user
 * does not exist.
 */
char * getPublicKey(char *);

/*
 * Retrieves the privilege for the given user and sector.
 * Returns "" if no prvilege was assigned for that user and
 * sector.
 */
char * getPrivilegeForUserSector(char * user, char * sector);

#endif
